using System;
using System.Workflow.ComponentModel.Design;
using System.Workflow.ComponentModel;

namespace OWA.Activities
{
    class AbstractPackageActivityDesigner : ActivityDesigner
    {
        protected override void Initialize(Activity activity)
        {
            base.Initialize(activity);            
            AbstractPackageActivity packageActivity = activity as AbstractPackageActivity;
            if (packageActivity != null &&
                packageActivity.IsBindingSet(
                    AbstractPackageActivity.PackageProperty) == false)
            {
                PackageScope scope = packageActivity.Parent as PackageScope;
                if (scope != null)
                {
                    packageActivity.SetBinding(AbstractPackageActivity.PackageProperty,
                        new ActivityBind(scope.Name, "Package"));
                }            
            }
        }
    }
}
